<!DOCTYPE >
<html>
{include file="head.html"}
<body>
<div> {include file='article/nav.html'}
	<div class="main-body w98">
  <form method="post" id="data-form" action="admin.php?m=article&a=save">
    <input type="hidden" name="id" style="display:none;" value="{$data.id}" >
    <div class="tabs-box">
    	<div class="js-tabs tabs-border">
        	<a class="item active" href="#base">基本信息</a>
            <a class="item" href="#t-content">内容详情</a>
            <a class="item" href="#other">扩展</a>
        </div>
        <div class="tabs-item active" id="base">
        	<table class="table table-bordered" >
      <tr>
        <td class="w90">标题：</td>
        <td><input type="text" name="title" class="w98" id="title" value="{$data.title}" ></td>
      </tr>
        <tr>
    <td >分类：</td>
    <td>
    <select name="catid" id="catid" class="w150">
    <option value="0">请选择</option>
    {foreach item=c from=$cat_list}
                <option value="{$c.catid}" {if $data.catid eq $c.catid} selected="selected"{/if}>{$c.cname}</option>
                {foreach item=c_2 from=$c.child}
                	<option value="{$c_2.catid}" {if $data.catid eq $c_2.catid} selected="selected"{/if} class="o_c_2">|__{$c_2.cname}</option>
                    {foreach item=c_3 from=$c_2.child}
                    <option value="{$c_3.catid}" {if $data.catid eq $c_3.catid} selected="selected"{/if} class="o_c_3"> |____{$c_3.cname}</option>
                    {/foreach}
                {/foreach}
                {/foreach}
    </select>
    
    
    
    </td>
  </tr>
    
      <tr>
        <td>关键字：</td>
        <td><input type="text" name="keywords" class="w98" id="keywords" value="{$data.keywords}" ></td>
      </tr>
      <tr>
        <td>描述：</td>
        <td><textarea class="w98 h60"  name="description" id="description"   >{$data.description}</textarea></td>
      </tr>
      {if $data}
      <tr>
        <td>发布时间：</td>
        <td>{$data.dateline|date:Y-m-d H:i:s}</td>
      </tr>
      {/if}
       
     
      <tr>
        <td>封面图片：</td>
        <td>
        	<div class="upload-row">
            	<div class="btn-upload">
                	上传图片
                	<input type="file" class="btn-upload-file" id="up1" onChange="uploadImg('up1')">
                </div>
                 <input type="hidden" name="imgurl"  class="upload-field" value="{$data.imgurl}" >
                 <div class="upload-show">
                 	{if $data.imgurl}<img src="{$data.imgurl|images_site}.100x100.jpg" width="50">{/if}
                 </div>
            </div>
       </td>
      </tr>
      
      <tr>
        <td>最后修改：</td>
        <td>{$data.last_time|date:Y-m-d H:i:s}</td>
      </tr>
       
      <tr>
        <td>访问数：</td>
        <td><input type="text" name="view_num" id="view_num" value="{$data.view_num}" ></td>
      </tr>
     
      
      
      <tr>
        <td>详情模板：</td>
        <td><input type="text" name="tpl" id="tpl" value="{$data.tpl}" >(如果需要可以指定模板)</td>
      </tr>
      
      
    </table>
        </div>
        <div class="tabs-item active" id="t-content">
        	 <table class="table table-bordered">
             		<tr>
        <td class="w90">内容：</td>
        <td><script type="text/plain"  id="content" name="content" >{$data.content}</script></td>
      </tr>
             </table>
        </div>
        <div class="tabs-item active" id="other">
        	<table class="table table-bordered">
            	 <tr>
        <td class="w90">产品价格：</td>
        <td><input type="text" name="price" id="price" value="{$data.price}" ></td>
      </tr>
      <tr>
        <td>市场价格：</td>
        <td><input type="text" name="market_price" id="market_price" value="{$data.market_price}" ></td>
      </tr>
      <tr>
        <td>库存数：</td>
        <td><input type="text" name="total_num" id="total_num" value="{$data.total_num}" ></td>
      </tr>
      <tr>
        <td>销售数：</td>
        <td><input type="text" name="sold_num" id="sold_num" value="{$data.sold_num}" ></td>
      </tr>
      <tr>
        <td>积分：</td>
        <td><input type="text" name="grade" id="sold_num" value="{$data.grade}" ></td>
      </tr>
      <tr>
      	<td>图集</td>
        <td>
        	{assign var="tablename" value="article"}
     	 {include file="picsup.html"} 
        </td>
      </tr>
      
            </table>
        </div>
    </div>
    <table class="table table-bordered">
    <tr>
        <td class="w90">&nbsp;</td>
        <td><input type="button" onClick="dataSubmit()" value="保存" class="btn btn-success"></td>
      </tr>
    </table>
  </form>
</div>
</div>
{include file="footer.html"}
{php loadEditor();}
 <script>
 	var editor=UE.getEditor('content',options);
</script>
<script>
function dataSubmit(){
	if($("#title").val()==""){
		$("#title").focus();
		skyToast('标题不能为空');
		return false;
	}
	if($("#catid").val()==0){
		$("#catid").focus();
		skyToast('请选择分类');
		return false;
	}
	 
	$.post($("#data-form").attr("action")+"&ajax=1",$("#data-form").serialize(),function(data){
			skyToast('保存成功');
	},"json");
	
}
function auto_post(){
	 
	if($("#title").val().length>0 && $("#catid").val()>0){
		$.post($("#data-form").attr("action")+"&ajax=1",$("#data-form").serialize(),function(data){
			skyToast('自动保存成功');
		});
	}
	setTimeout(function(){
		auto_post();
	},20000)
}
</script>
</body>
</html>